<html>
<head><meta charset="utf-8"><title>checking attr labels · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html">checking attr labels</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="157968963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157968963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157968963">(Feb 10 2019 at 10:06)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> CHECK-LABEL does not allow binding variables</p>



<a name="157968969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157968969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157968969">(Feb 10 2019 at 10:06)</a>:</h4>
<p>so I need a CHECK AFAICT</p>



<a name="157968976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157968976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157968976">(Feb 10 2019 at 10:07)</a>:</h4>
<div class="codehilite"><pre><span></span>// CHECK-LABEL @foo
// CHECK-SAME [[FOO_ATTRIBUTE:#[0-9]+]]
</pre></div>


<p>then</p>



<a name="157968979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157968979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157968979">(Feb 10 2019 at 10:07)</a>:</h4>
<p>but then because I have two functions I get two attributes at the end of the module, and FileCheck always tries to match the <a href="https://github.com/rust-lang/rust/issues/0" target="_blank" title="https://github.com/rust-lang/rust/issues/0">#0</a> instead of expanding the label</p>



<a name="157968986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157968986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157968986">(Feb 10 2019 at 10:07)</a>:</h4>
<p>I tried that too, and that does capture the attribute number</p>



<a name="157969027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157969027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157969027">(Feb 10 2019 at 10:08)</a>:</h4>
<p>but then somewhere I need a CHECK #[[FOO_ATTRIBUTE]] = ...</p>



<a name="157969030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157969030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157969030">(Feb 10 2019 at 10:08)</a>:</h4>
<p>and the attributes at the end of the module can be in any order</p>



<a name="157969093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157969093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157969093">(Feb 10 2019 at 10:10)</a>:</h4>
<p>sure, that can go at the end of the file for all attributes you care about. you can use <code>CHECK-DAG</code> to verify attributes come in whatever order.</p>



<a name="157969095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157969095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157969095">(Feb 10 2019 at 10:10)</a>:</h4>
<p>alternative is to check for <code>Function Attrs</code> comment on top of your labels.</p>



<a name="157969096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157969096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157969096">(Feb 10 2019 at 10:10)</a>:</h4>
<p>(which is, admittedly easier and most likely cleaner)</p>



<a name="157969115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157969115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157969115">(Feb 10 2019 at 10:11)</a>:</h4>
<p>I remember dealing with this problem before for optimize attribute myself, and ended up just checking the comment.</p>



<a name="157969163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157969163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157969163">(Feb 10 2019 at 10:12)</a>:</h4>
<p>when i put it at the end of the file, it does not match the correct line</p>



<a name="157969180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157969180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157969180">(Feb 10 2019 at 10:13)</a>:</h4>
<p>it should match .. <a href="https://github.com/rust-lang/rust/issues/1" target="_blank" title="https://github.com/rust-lang/rust/issues/1">#1</a> = ... , but it first tries to match ... <a href="https://github.com/rust-lang/rust/issues/0" target="_blank" title="https://github.com/rust-lang/rust/issues/0">#0</a> = ... and that fails, erroring there (it suggests if I wanted to match the second attribute)</p>



<a name="157969221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157969221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157969221">(Feb 10 2019 at 10:14)</a>:</h4>
<p>ill check the tests for the optimize attribute</p>



<a name="157969363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157969363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157969363">(Feb 10 2019 at 10:19)</a>:</h4>
<p>The test is <a href="https://github.com/rust-lang/rust/blob/master/src/test/codegen/optimize-attr-1.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/test/codegen/optimize-attr-1.rs">https://github.com/rust-lang/rust/blob/master/src/test/codegen/optimize-attr-1.rs</a> and turns out it is actually checking the attributes <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="157970808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157970808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157970808">(Feb 10 2019 at 11:04)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> should be fixed, I had to use <code>CHECK-DAG</code> :)</p>



<a name="157970818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157970818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157970818">(Feb 10 2019 at 11:05)</a>:</h4>
<p>FileCheck is quite nice</p>



<a name="157973174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157973174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157973174">(Feb 10 2019 at 12:18)</a>:</h4>
<p>okay, I cannot really r+ this because that is more of a language decision, but the implementation looks fine</p>



<a name="157973179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20attr%20labels/near/157973179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20attr.20labels.html#157973179">(Feb 10 2019 at 12:18)</a>:</h4>
<p>I’ll write a comment to that effect.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>